/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.playground.core.entity.boardgame.tictactoe;

import com.playground.core.entity.boardgame.Board;
import com.playground.core.entity.boardgame.Square;
import java.util.ArrayList;

/**
 *
 * @author Cleber
 */
public class TicTacToeBoard extends Board{


    public TicTacToeBoard() {
        super();
        createSquares();
    }

    private void createSquares() {
        ArrayList<Square> squares = new ArrayList<Square>();
        for (int i = 0; i < 3; i++){
            for (int j = 0; j <3; j++){
                    squares.add(new TicTacToeSquare(i,j));
            }
        }
        setSquares(squares);
    }
    
    public boolean hasAvailableSquare(){
        for (Square sq : this.getSquares()){
            if (sq.isFree()) return true;
        }
        return false;
    }
    
    
    
}
